﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace AutoGam
{
    public partial class UsbCardForm : Form
    {
        public UsbCardForm()
        {
            InitializeComponent();
        }

        private void UsbCardForm_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
                case Keys.Escape:
                    this.Close();
                    break;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            listBox1.Items.Add("08:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block08));
            Application.DoEvents();
            listBox1.Items.Add("09:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block09));
            Application.DoEvents();
            listBox1.Items.Add("10:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block10));
            Application.DoEvents();
            listBox1.Items.Add("12:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block12));
            Application.DoEvents();
            listBox1.Items.Add("13:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block13));
            Application.DoEvents();
            listBox1.Items.Add("14:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block14));
            Application.DoEvents();
            listBox1.Items.Add("16:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block16));
            Application.DoEvents();
            listBox1.Items.Add("17:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block17));
            Application.DoEvents();
            listBox1.Items.Add("18:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block18));
            Application.DoEvents();
            listBox1.Items.Add("20:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block20));
            Application.DoEvents();
            listBox1.Items.Add("21:" + Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block21));
        }

        private void button2_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            listBox1.Items.Add("08:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block08), KEW.InterFace.Block.Block08));
            Application.DoEvents();
            listBox1.Items.Add("09:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block09), KEW.InterFace.Block.Block09));
            Application.DoEvents();
            listBox1.Items.Add("10:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block10), KEW.InterFace.Block.Block10));
            Application.DoEvents();
            listBox1.Items.Add("12:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block12), KEW.InterFace.Block.Block12));
            Application.DoEvents();
            listBox1.Items.Add("13:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block13), KEW.InterFace.Block.Block13));
            Application.DoEvents();
            listBox1.Items.Add("14:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block14), KEW.InterFace.Block.Block14));
            Application.DoEvents();
            listBox1.Items.Add("16:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block16), KEW.InterFace.Block.Block16));
            Application.DoEvents();
            listBox1.Items.Add("17:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block17), KEW.InterFace.Block.Block17));
            Application.DoEvents();
            listBox1.Items.Add("18:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block18), KEW.InterFace.Block.Block18));
            Application.DoEvents();
            listBox1.Items.Add("20:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block20), KEW.InterFace.Block.Block20));
            Application.DoEvents();
            listBox1.Items.Add("21:" + Device.UsbCardDevice.WriteBlock(Device.UsbCardDevice.ReadBlock(KEW.InterFace.Block.Block21), KEW.InterFace.Block.Block21));
        }

        private void button3_Click(object sender, EventArgs e)
        {
            listBox1.Items.Clear();
            listBox1.Items.Add("08:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block08));
            Application.DoEvents();
            listBox1.Items.Add("09:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block09));
            Application.DoEvents();
            listBox1.Items.Add("10:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block10));
            Application.DoEvents();
            listBox1.Items.Add("12:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block12));
            Application.DoEvents();
            listBox1.Items.Add("13:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block13));
            Application.DoEvents();
            listBox1.Items.Add("14:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block14));
            Application.DoEvents();
            listBox1.Items.Add("16:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block16));
            Application.DoEvents();
            listBox1.Items.Add("17:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block17));
            Application.DoEvents();
            listBox1.Items.Add("18:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block18));
            Application.DoEvents();
            listBox1.Items.Add("20:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block20));
            Application.DoEvents();
            listBox1.Items.Add("21:" + Device.UsbCardDevice.WriteBlock("", KEW.InterFace.Block.Block21));
        }
    }
}
